package com.huilai.platform.country_platform.repository;

import com.huilai.platform.country_platform.model.FeedbackBe;
import com.huilai.platform.country_platform.model.FeedbackPerson;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import javax.transaction.Transactional;

/**
 * 作者：洪霓
 * 日期：2023/3/3
 * 注释：
 */
public interface FeedbackBeReposity extends JpaRepository<FeedbackBe, Integer>, JpaSpecificationExecutor<FeedbackBe> {

    @Modifying(clearAutomatically = true)
    @Transactional
    @Query(value = "insert into feedback_be(`be_name`, `be_unit`, `be_position`, `be_level`) values(:#{#feedbackBe.name}, :#{#feedbackBe.unit}, :#{#feedbackBe.position}, :#{#feedbackBe.level})", nativeQuery = true)
    Integer addFeedbackBe(FeedbackBe feedbackBe);


    FeedbackBe findFeedbackBeByNameAndUnitAndPositionAndLevel(String name, String unit, String position, String level);

}
